package com.itheima.demo02;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class StreamClass08 {
    public static void main(String[] args) {
        HashSet<String> hs = new HashSet<>(Set.of("张三，23","李四，24","王五，25","赵六，26"));
        Stream<String> stream = hs.stream();
        Stream<String> stringStream = stream.filter(s -> {
            int age = Integer.parseInt(s.split("，")[1]);
            return age >= 24;
        });
        Map<String, Integer> collect = stringStream.collect(Collectors.toMap(
                s -> s.split("，")[0],
                s -> Integer.parseInt(s.split("，")[1])
        ));
        System.out.println(collect);
    }
}
